import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { FormGroup, FormBuilder, Validators, AbstractControl } from '@angular/forms';

@Component({
  selector: 'app-password-form',
  templateUrl: './password-form.component.html'
})
export class PasswordFormComponent implements OnInit {
  protected f!: FormGroup;
  protected passwordVisible = false;

  constructor(private formBuilder: FormBuilder) {}

  ngOnInit(): void {
    this.initForm();
  }

  initForm(): void {
    this.f = this.formBuilder.group({
      password: [null, [Validators.required]]
    });
  }

  get form(): FormGroup {
    return this.f;
  }

  get password(): AbstractControl | null {
    return this.f.get('password');
  }

  get valid(): boolean {
    return this.f.valid;
  }
}
